// 这是文章分类的路由模块

const express = require('express')
const router = express.Router()

// 导入文章分类的路由处理函数模块
const artCate_handler = require('../router_handler/artcate')

// 导入验证数据的中间件
const expressJoi = require('@escook/express-joi')
// 导入需要的验证规则对象
// const { add_cate_schema, delete_cate_schema, get_cate_schema, update_cate_schema } = require('../schema/artcate')
const { add_cate_schema, get_articledatails_schema, get_notice_article_schema, update_like_schema } = require('../schema/artcate')
const { route } = require('express/lib/application')

// 获取文章分类列表数据的路由
router.get('/cates', artCate_handler.getArtCates)
// 动漫文章分类路由
router.get('/cartoncates', artCate_handler.getCartonCates)
// 游戏文章分类路由
router.get('/gamescates', artCate_handler.getGamesCates)
// 杂谈文章分类路由
router.get('/tattlecates', artCate_handler.getTattleCates)
// 热门文章列表
router.get('/hotcates', artCate_handler.getHotList)
// 新增文章分类的路由
// router.post('/addcates', expressJoi(add_cate_schema), artCate_handler.addArticleCates)
router.post('/addcates', expressJoi(add_cate_schema), artCate_handler.addArticleCates)
// 根据作者名返回文章列表路由
router.post('/noticearticle', expressJoi(get_notice_article_schema), artCate_handler.getNoticeArticle)
// 根据文章id进行点赞功能
router.post('/addlike', expressJoi(update_like_schema), artCate_handler.addLike)
// 取消点赞功能
router.post('/cancellike', expressJoi(update_like_schema), artCate_handler.cancelLike)
// 获取点赞数接口
router.get('/likenums/:id', expressJoi(get_articledatails_schema), artCate_handler.likeNums)
// 获取本人的文章列表
router.post('/selflist', expressJoi(get_notice_article_schema), artCate_handler.getSelfList)
// 删除本人的文章列表
router.post('/delselflist', expressJoi(update_like_schema), artCate_handler.delSelfList)
// 根据 Id 删除文章分类的路由
// router.get('/deletecate/:id', expressJoi(delete_cate_schema), artCate_handler.deleteCateById)
// // 根据 Id 获取文章分类的路由
// router.get('/cates/:id', expressJoi(get_cate_schema), artCate_handler.getArtCateById)
// // 根据 Id 更新文章分类的路由
// router.post('/updatecate', expressJoi(update_cate_schema), artCate_handler.updateCateById)
// 获取文章详情的路由
router.get('/articledetails/:id',expressJoi(get_articledatails_schema), artCate_handler.getArtcleDetails)

module.exports = router
